package com.wk1un2.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wk1un2.dao.RolesDao;
import com.wk1un2.service.RolesService;

@Service
public class RolesServiceImpl implements RolesService {
	@Autowired
	private RolesDao rolesdao;

	@Override
	public List<Map<String, Object>> getAllRoles(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.getAllRoles(map);
	}

	@Override
	public Integer count(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.count(map);
	}

	@Override
	public Integer add(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.add(map);
	}

	@Override
	public Integer update(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.update(map);
	}

	@Override
	public Integer delete(Integer id) {
		// TODO Auto-generated method stub
		return rolesdao.delete(id);
	}

	@Override
	public List<Map<String, Object>> getAllBoxMenus(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.getAllBoxMenus(map);
	}

	@Override
	public List<Map<String, Object>> getAllBoxRoleMenus(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.getAllBoxRoleMenus(map);
	}

	@Override
	public Integer addBoxMenus(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.addBoxMenus(map);
	}

	@Override
	public Integer deleteBoxMenus(Integer roleid, Integer menuid) {
		// TODO Auto-generated method stub
		return rolesdao.deleteBoxMenus(roleid, menuid);
	}

	@Override
	public Integer insertRoleModule(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.insertRoleModule(map);
	}

	@Override
	public Integer deleteRoleModule(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return rolesdao.deleteRoleModule(map);
	}

	@Override
	public List<Map<String, Object>> getModules(Integer roleid) {
		// TODO Auto-generated method stub
				List<Map<String, Object>> module= rolesdao.getModules(roleid);
				Map<String, Object> check=new HashMap<>();
				for (Map<String, Object> m : module) {
					check.put("type", 0);
					check.put("checked", 0);
					m.put("checkArr", check);
				}
				return module;
			
	}

	@Override
	public Integer getRolesName(String rolename) {
		// TODO Auto-generated method stub
		return rolesdao.getRolesName(rolename);
	}

	@Override
	public Integer getRolesUser(Integer roleid) {
		// TODO Auto-generated method stub
		return rolesdao.getRolesUser(roleid);
	}

}
